Skip to content

Infer flash target for single bare bin#10

Merged
ataffanel merged 3 commits into
mainfrom
ataffanel/single-bin-target-flash
Jun 24, 2026
Merged

Infer flash target for single bare bin#10
ataffanel merged 3 commits into
mainfrom
ataffanel/single-bin-target-flash

Conversation

@ataffanel

@ataffanel ataffanel commented Jun 22, 2026

Copy link
Copy Markdown
Member

There is a hole in the cli ux: there is no way, from command line, to specify a single binary and a target for this binary. For example the followin still display an interactive target choice: `cfcli bootload flash --targets bcLighthouse4-fw --bin lighthouse.bin'.

This PR enables the syntax above, making it work as expected: equivalent to choosing bcLighthouse4-fw in the interactive list.

Summary

  • Infer a bare --bin file target from a single explicit --targets value.
  • Keep ambiguous multi-bin or multi-target cases on the existing prompt/error path.
  • Document the non-interactive single-bin/single-target usage.

Test Plan

  • cargo test --quiet && cargo check --quiet

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes a CLI UX gap in cfcli bootload flash by allowing a single bare --bin <file> to be associated with a single explicit --targets <target> value, avoiding an interactive target prompt when the intent is unambiguous.

Changes:

  • Add logic to infer the flash target when --bin contains exactly one bare file and --targets contains exactly one target.
  • Keep existing interactive prompt / error behavior for ambiguous cases (multiple bins or multiple targets).
  • Document the new non-interactive single-bin/single-target usage and fix typos in the bootload docs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main.rs Adds a helper + unit tests and uses it to infer a target for a single bare --bin entry when --targets is a single value.
docs/bootload.md Documents --bin <file> --targets <target> usage and corrects “promt” → “prompt”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main.rs Outdated

@stefanthorstenson stefanthorstenson left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition! Tested and confirmed functionality with
$ cargo run bootload flash --bin /home/stefan/code/bitcraze/crazyflie-firmware/build/cf21bl.bin --targets stm32-fw

One review comment.

Comment thread src/main.rs
ataffanel and others added 2 commits June 23, 2026 11:20
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@stefanthorstenson stefanthorstenson left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Confirmed error print for non-existing target.

@ataffanel ataffanel merged commit 2f64a80 into main Jun 24, 2026
1 check passed
@ataffanel ataffanel deleted the ataffanel/single-bin-target-flash branch June 24, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants